]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ci: Support additional destdir in install-meson-project.sh
authorMartin Abente Lahaye <martin.abente@codethink.co.uk>
Sat, 13 Jul 2024 03:52:01 +0000 (23:52 -0400)
committerFlorian Müllner <fmuellner@gnome.org>
Sat, 3 Aug 2024 18:03:08 +0000 (20:03 +0200)
To build a system extension we need to:

1. Add dependencies to the container (to build it), and also
2. Add dependencies to the extension (to run it, later).

So there's effectively two locations where we need to install
those dependencies.

See https://discourse.gnome.org/t/towards-a-better-way-to-hack-and-test-your-system-components/21075
See https://gitlab.gnome.org/GNOME/gnome-build-meta/-/issues/837

Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3390>
(cherry picked from commit 2e5c3aec161e663a5d5264439df5832b0c885217)

.gitlab-ci/install-meson-project.sh

index 3465df0aca96265ba4abd80757f910f1f2c36f86..7750193414f2fec3ea1d050c4a812a883f1227f2 100755 (executable)
@@ -13,6 +13,7 @@ usage() {
          --subdir       Build subdirectory instead of whole project
          --prepare      Script to run before build
          --libdir       Setup the project with a different libdir
+         --destdir      Install the project to an additional destdir
 
          -h, --help     Display this help
 
@@ -25,6 +26,7 @@ TEMP=$(getopt \
   --longoptions='subdir:' \
   --longoptions='prepare:' \
   --longoptions='libdir:' \
+  --longoptions='destdir:' \
   --longoptions='help' \
   -- "$@")
 
@@ -34,6 +36,7 @@ unset TEMP
 MESON_OPTIONS=()
 SUBDIR=.
 PREPARE=:
+DESTDIR=""
 
 while true; do
   case "$1" in
@@ -57,6 +60,11 @@ while true; do
       shift 2
     ;;
 
+    --destdir)
+      DESTDIR=$2
+      shift 2
+    ;;
+
     -h|--help)
       usage
       exit 0
@@ -85,5 +93,11 @@ git clone --depth 1 "$REPO_URL" -b "$COMMIT" "$CHECKOUT_DIR"
 pushd "$CHECKOUT_DIR/$SUBDIR"
 sh -c "$PREPARE"
 meson setup --prefix=/usr _build "${MESON_OPTIONS[@]}"
+
+# Install it to an additional directory e.g., system extension directory
+if [ -n "${DESTDIR}" ]; then
+    sudo meson install -C _build --destdir=$DESTDIR
+fi
+
 sudo meson install -C _build
 popd